package WizardInstall;

import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
/**
 * 
 * @author Guy
 *
 */
class LoginPage extends WizardPage {
	public static final String PAGE_NAME = "Login";

	private Text textUserName;
	private Text textPassword;
	private Text textError;
	/**
	 * Constructor to Login page
	 */
	public LoginPage() {
		super(PAGE_NAME, "Login Page", null);
	}


	/**
	 * Create the controls(buttons,Labels,text)
	 */
	public void createControl(Composite parent) {
		Composite topLevel = new Composite(parent, SWT.NONE);
		topLevel.setLayout(new GridLayout(2, false));

		/*    Label l = new Label(topLevel, SWT.CENTER);
    l.setText("Enter user name and password:");*/

		Label l1=new Label(topLevel, SWT.CENTER);
		l1.setText("UserName: ");
		textUserName = new Text(topLevel, SWT.SINGLE);
		textUserName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

		Label l2=new Label(topLevel, SWT.CENTER);
		l2.setText("Password: ");
		textPassword = new Text(topLevel, SWT.SINGLE  | SWT.PASSWORD);
		textPassword.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

		textError = new Text(topLevel, SWT.SINGLE);
		textError.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
		textError.setEnabled(false);
		textError.setText("");

		setControl(topLevel);
		setPageComplete(true);
	}
	/**
	 * update error text
	 * @param strError
	 */
	public void updateTextError(String strError)
	{
		textError.setText(strError);
	}
	/**
	 * Get user name
	 * @return String
	 */
	public String getUserName() {
		return textUserName.getText();
	}

	public String getPassword() {
		return textPassword.getText();
	}
}


